package top.yokey.shopnc.model;

import top.yokey.shopnc.base.BaseConstant;
import top.yokey.base.base.BaseHttpClient;
import top.yokey.base.base.BaseHttpListener;

@SuppressWarnings("ALL")
public class StoreModel {

    private final String ACT = "store";
    private static volatile StoreModel instance;

    public static StoreModel get() {
        if (instance == null) {
            synchronized (StoreModel.class) {
                if (instance == null) {
                    instance = new StoreModel();
                }
            }
        }
        return instance;
    }

    public void streetClass(BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready("shop_class", "index")
                .get(baseHttpListener);

    }

    public void storeInfo(String storeId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "store_info")
                .add("store_id", storeId)
                .post(baseHttpListener);

    }

    public void storeIntro(String storeId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "store_intro")
                .add("store_id", storeId)
                .post(baseHttpListener);

    }

    public void storePromotion(String storeId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "store_promotion")
                .add("store_id", storeId)
                .post(baseHttpListener);

    }

    public void storeGoodsClass(String storeId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "store_goods_class")
                .add("store_id", storeId)
                .post(baseHttpListener);

    }

    public void storeNewGoods(String storeId, String page, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "store_new_goods")
                .add("store_id", storeId)
                .add("page", BaseConstant.PAGE)
                .add("curpage", page)
                .get(baseHttpListener);

    }

    public void streetList(String keyword, String scId, String page, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready("shop", "shop_list")
                .add("key", "4")
                .add("keyword", keyword)
                .add("sc_id", scId)
                .add("page", BaseConstant.PAGE)
                .add("curpage", page)
                .get(baseHttpListener);

    }

    public void storeGoodsRank(String storeId, String type, String num, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "store_goods_rank")
                .add("store_id", storeId)
                .add("ordertype", type)
                .add("num", num)
                .post(baseHttpListener);

    }

    public void storeGoods(String storeId, String keyword, String stcId, String order, String key, String priceFrom, String priceTo, String page, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "store_goods")
                .add("store_id", storeId)
                .add("keyword", keyword)
                .add("stc_id", stcId)
                .add("order", order)
                .add("key", key)
                .add("price_from", priceFrom)
                .add("price_to", priceTo)
                .add("page", BaseConstant.PAGE)
                .add("curpage", page)
                .get(baseHttpListener);

    }

}
